﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace WeatherClientWindowsApp
{
    using WeatherClientWindowsApp.WeatherServiceClient;

    public partial class WeatherForm : Form
    {
        public WeatherForm()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {
            using(WeatherInfoServiceClient client = new WeatherInfoServiceClient())
            {
                if(cmbLocations.SelectedItem == null)
                {
                    MessageBox.Show("Please select location first.");
                    return;
                }

                string location = cmbLocations.SelectedItem.ToString();
                decimal temperature = client.GetTemperature(location);
                lblWeatherInfo.Text = string.Format("Temperature is: {0}", temperature);
            }
        }
    }
}
